package com.misty.abstract_factory;


import com.misty.abstract_factory.factory.FemaleFactory;
import com.misty.abstract_factory.factory.HumanFactory;
import com.misty.abstract_factory.factory.MaleFactory;
import com.misty.abstract_factory.human.Human;
import org.junit.Test;


/**
 * Provide an interface for creating families of related or dependent objects without specifying their concrete classes.
 * （为创建一组相关或相互依赖的对象提供一个接口，而且无须指定它们的具体类。）
 */
public class Demo {
    @Test
    public void test() {
        HumanFactory maleFactory = new MaleFactory();
        HumanFactory femaleFactory = new FemaleFactory();
        Human maleBlackMan = maleFactory.createBlackHuman();
        Human femaleBlackMan = femaleFactory.createBlackHuman();
        maleBlackMan.getColor();
        maleBlackMan.talk();
        maleBlackMan.getSex();
    }
}
